//
// Created by kriko on 2021/7/9.
//

#include <csapp.h>
#include "sum.h"
#include "str_echo09.h"

void str_echo(int sockfd) {
    ssize_t n;
    args_t args;
    result_t result;

    while(1) {
        if ((n = read(sockfd, &args, sizeof args)) == 0) {
            return;
        }
        result.sum = args.arg1 + args.arg2;
        Write(sockfd, &result, sizeof result);
    }
}